<%@ page language="java" contentType="text/html; charset=UTF-8"    pageEncoding="UTF-8"%>
<%@ page import="jsp.util.ConnectionContext" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%
   request.setCharacterEncoding("utf8");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-83"/>
<title></title>
</head>
<body>
</body>
</html>

<jsp:useBean id="rank" class="jsp.bean.Ranking" />
<jsp:setProperty name="rank" property="*" />
<%
int lastRow = 0;
try{
	Connection conn = ConnectionContext.getConnection();
	Statement stmt = conn.createStatement();
	String strSQL = "SELECT count(*) FROM pbgametable";
	ResultSet rs = stmt.executeQuery(strSQL);
	if (rs.next())
		lastRow = rs.getInt(1);
	rs.close();

	PreparedStatement pstmt = conn.prepareStatement("INSERT INTO pbgametable(id,name,time)"+ " values (?,?,?)");				
	pstmt.setInt(1, (lastRow + 1));
	String sw = rank.getName();
	sw = sw != null ? new String(sw.getBytes("iso-8859-1"),"utf8") : null;
	pstmt.setString(2, sw);
	pstmt.setInt(3, rank.getTime());
	pstmt.executeUpdate();
	
}catch(SQLException ex){
%>
에러: <%=ex %>
<% 
	}
%>




